package C618;

/**
 * @description: 静态块实现饿汉式单例
 * @author: luolidong
 * @create: 2021-06-18 17:14
 * @version: 1.0
 */
public class Person {
    private static Person person=null;
    static {
        person=new Person();
    }
    private int id;
    private String name;
    private String sex;

    private Person() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
    public static Person getInstance(){
        return person;
    }
}
